package com.github.ghsea.scheduler.timer;

import java.util.concurrent.TimeUnit;


/**
 * @author netty
 */
public interface TimerTask {

    /**
     * Executed after the delay specified with
     * {@link Timer#newTimeout(org.jboss.netty.util.TimerTask, long, TimeUnit)}.
     *
     * @param timeout a handle which is associated with this task
     */
    void run(Timeout timeout) throws Exception;

    /**
     * added by guhai.
     * 获取第一个timeout。第1个Timeout所在tick固定之后，之后放入的Timeout都放入同一个tick。从而避免数据倾斜
     * @return
     */
    Timeout getFirstTimeout();

}
